import {request, handleFetchResultNotification, REQUEST_TYPE} from '../utils';
import stringify from 'Shared/utils/stringify';
import {formatMessage} from './intl';
const baseUrl = '/parts/api/v1';


const getListDesc = formatMessage({
    id: 'api.message.getListDesc',
    defaultMessage: '查询总代进销存报表'
});
// 查询总代进销存报表
export const getList = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/partStockMonths?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};

// 查询总代进销存报表折线图
export const getListType = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/partStockMonths/type?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};

// 查询总代进销存报表环形图
export const getListRate = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/partStockMonths/rate?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
